/**
 * @Author:  renyc
 * @Date: 2022年12月8日11:34:52
 */
'use strict';

class Envelope{
    constructor(xmin, ymin, xmax, ymax){
        this._xmin = xmin || 0.0;
        this._ymin = ymin || 0.0;
        this._xmax = xmax || 0.0;
        this._ymax = ymax || 0.0;
    }

    get xmin(){
        return this._xmin;
    }

    get xmax(){
        return this._xmax;
    }

    get ymin(){
        return this._ymin;
    }

    get ymax(){
        return this._ymax;
    }

    get width(){
        return (this._xmax - this._xmin);
    }

    get height(){
        return (this._ymax - this._ymin);
    }

    get center(){
        let cx = (this._xmin + this._xmax) / 2.0;
        let cy = (this._ymin + this._ymax) / 2.0;
        return {
            lng : cx,
            lat : cy
        };
    }
}

export default Envelope;
